import React, { Component, Suspense } from 'react';
// import { connect } from 'dva';
import { Layout, Menu, Breadcrumb, Carousel, Row, Col, Icon, List, Typography } from 'antd';
// import Slider from "react-slick";
// import Ellipsis from 'ant-design-pro/lib/Ellipsis';
// import 'ant-design-pro/dist/ant-design-pro.css';
// import { JIANTOU2 } from '../../constants'
import ListItem from '@/components/ListItem'
import styles from './index.less';
// import { FormattedMessage, formatMessage } from 'umi-plugin-react/locale';

class SliderItemList extends Component {
  state = {
  };

  componentDidMount() {
  }

  componentWillUnmount() {
  }

  listItemClick = (index, id) =>{
    let url = '';
    if (index == "1"){
      if (id === 1) {
        url = '/ipag/introduction';
      }
      else if (id === 2) {
        url = '/finland-central-university/introduction';
      }
      else if (id === 3) {
        url = '/paul-valery/introduction';
      }
      else if (id === 4) {
        url = '/lyon3/introduction';
      }
      // window.open(`http://home.himedu.cn${url}?collegeId=${id}`, '_blank')
      window.open(`http://home.himedu.cn/university/about-school?collegeId=${id}`, '_blank')
    } else if (index == "2"){
      if (id === 1) {
        url = '/ipag/projectIntroduction';
      }
      else if (id === 2) {
        url = '/finland-central-university/projectIntroduction';
      }
      else if (id === 3) {
        url = '/paul-valery/projectIntroduction';
      }
      else if (id === 4) {
        url = '/lyon3/projectIntroduction';
      }
      // window.open(`http://home.himedu.cn${url}?collegeId=${id}`, '_blank')
      window.open(`http://home.himedu.cn/university/project-introduction?collegeId=${id}`, '_blank')
    } else if (index == "3"){
      if (id === 1) {
        url = '/ipag/information';
      }
      else if (id === 2) {
        url = '/finland-central-university/information';
      }
      else if (id === 3) {
        url = '/paul-valery/information';
      }
      else if (id === 4) {
        url = '/lyon3/information';
      }
      // window.open(`http://home.himedu.cn${url}?collegeId=${id}`, '_blank')
      window.open(`http://home.himedu.cn/university/information?collegeId=${id}`, '_blank')
    }

  }

  render() {
    const { dataSource, id} = this.props;

    const titleList= [{
      title: '学校简介',
      index:'1'
    },{
      title: '项目介绍',
      index:'2'
    },{
      // title:localStorage.getItem('umi_locale') == 'zh-CN'?'学校资讯':'School Information',
      title: '学校资讯',
      index:'3'
    },
    ]

    const newDataSource = titleList.map(item => <ListItem data={item.title} index={item.index} />);
    // console.log("newDataSource",newDataSource)
    return (
        <List
            className={styles.list}
            size="small"
            // header={<div>Header</div>}
            // footer={<div>Footer</div>}
            // bordered
            dataSource={newDataSource}
            renderItem={item => (<List.Item onClick={() => this.listItemClick(item.props.index, id)}><span style={{cursor: 'pointer'}}>{item}</span></List.Item>)}
            style={{borderBottom: '1px solid #e8e8e8'}}
        />
    );
  }
}

export default SliderItemList;

